<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>相册列表 - 社交筛选</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #3b82f6;
            --primary-light: #60a5fa;
            --primary-dark: #2563eb;
            --secondary: #8b5cf6;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #111827;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f9fafb;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --border-medium: #d1d5db;
            --radius: 8px;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .nav-actions {
            display: flex;
            gap: 15px;
            font-size: 1.2rem;
        }
        
        /* 高级搜索按钮 */
        .advanced-search-btn {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--primary);
            background: none;
            border: none;
            font-size: 0.9rem;
            z-index: 10;
        }
        
        /* 搜索栏 */
        .search-bar {
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            position: relative;
        }
        
        .search-input-group {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 15px 10px 40px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            font-size: 0.9rem;
            background-color: var(--bg-light);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-light);
        }
        
        /* 筛选面板 */
        .filters-panel {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        
        .filters-panel.collapsed {
            max-height: 0;
            border-bottom: none;
        }
        
        .filter-section {
            padding: 12px 15px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .filter-section:last-child {
            border-bottom: none;
        }
        
        .filter-section-title {
            font-size: 0.95rem;
            font-weight: 600;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .filter-section-title i {
            color: var(--primary);
            font-size: 1rem;
        }
        
        /* 标签筛选 */
        .tag-filter {
            display: flex;
            padding: 5px 15px 10px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .tag-filter::-webkit-scrollbar {
            display: none;
        }
        
        .filter-tag {
            padding: 6px 15px;
            border-radius: 15px;
            font-size: 0.9rem;
            white-space: nowrap;
            margin-right: 8px;
            color: var(--text-secondary);
            background-color: var(--bg-light);
        }
        
        .filter-tag.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 日期筛选 */
        .date-filter {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        
        .date-option {
            flex: 1;
            min-width: 80px;
            padding: 8px;
            border-radius: var(--radius);
            border: 1px solid var(--border-light);
            text-align: center;
            font-size: 0.9rem;
            color: var(--text-secondary);
        }
        
        .date-option.active {
            border-color: var(--primary);
            color: var(--primary);
            background-color: rgba(59, 130, 246, 0.05);
        }
        
        /* 排序筛选 */
        .sort-options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .sort-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 8px 10px;
            border-radius: var(--radius);
            font-size: 0.9rem;
            color: var(--text-secondary);
        }
        
        .sort-option.active {
            background-color: rgba(59, 130, 246, 0.05);
            color: var(--primary);
        }
        
        .sort-option i {
            opacity: 0;
        }
        
        .sort-option.active i {
            opacity: 1;
        }
        
        /* 人数筛选 */
        .people-filter {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .people-option {
            padding: 6px 12px;
            border-radius: 15px;
            font-size: 0.9rem;
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
        }
        
        .people-option.active {
            border-color: var(--primary);
            color: var(--primary);
            background-color: rgba(59, 130, 246, 0.05);
        }
        
        /* 筛选器切换按钮 */
        .filter-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            color: var(--text-secondary);
            font-size: 0.95rem;
        }
        
        .filter-toggle i {
            margin-right: 8px;
            transition: transform 0.3s ease;
        }
        
        .filter-toggle.collapsed i {
            transform: rotate(-180deg);
        }
        
        /* 视图切换 */
        .view-toggle {
            display: flex;
            justify-content: flex-end;
            padding: 10px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
        
        .toggle-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--bg-light);
            border: none;
            margin-left: 10px;
            color: var(--text-secondary);
        }
        
        .toggle-btn.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 已选筛选标签 */
        .selected-filters {
            padding: 8px 15px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }
        
        .selected-filter {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--primary);
            border-radius: 15px;
            font-size: 0.85rem;
        }
        
        .selected-filter i {
            cursor: pointer;
            font-size: 0.9rem;
        }
        
        .clear-filters {
            margin-left: auto;
            color: var(--text-secondary);
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        /* 相册列表容器 */
        .album-container {
            padding: 10px;
        }
        
        /* 相册网格布局 */
        .album-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
        }
        
        /* 相册列表布局 */
        .album-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        /* 相册卡片基础样式 */
        .album-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s;
        }
        
        .album-card:hover {
            transform: translateY(-2px);
        }
        
        /* 网格布局相册卡片 */
        .album-card.grid {
            display: flex;
            flex-direction: column;
        }
        
        /* 列表布局相册卡片 */
        .album-card.list {
            display: flex;
            height: 120px;
        }
        
        /* 相册封面容器 */
        .album-cover {
            position: relative;
            overflow: hidden;
        }
        
        /* 网格布局封面 */
        .album-cover.grid {
            width: 100%;
            aspect-ratio: 1;
        }
        
        /* 列表布局封面 */
        .album-cover.list {
            width: 120px;
            height: 100%;
        }
        
        .album-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s;
        }
        
        .album-card:hover .album-image {
            transform: scale(1.05);
        }
        
        .image-count {
            position: absolute;
            bottom: 8px;
            right: 8px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            font-size: 0.8rem;
            padding: 2px 6px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 相册信息 */
        .album-info {
            padding: 10px;
        }
        
        /* 网格布局信息 */
        .album-info.grid {
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        /* 列表布局信息 */
        .album-info.list {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .album-title {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 3px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .album-meta {
            display: flex;
            align-items: center;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .album-meta.grid {
            margin-top: auto;
        }
        
        .album-date {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .album-people {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-left: 10px;
        }
        
        .album-likes {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-left: auto;
        }
        
        /* 瀑布流布局 */
        .album-masonry {
            column-count: 2;
            column-gap: 10px;
        }
        
        .masonry-item {
            break-inside: avoid;
            margin-bottom: 10px;
        }
        
        .masonry-item .album-card {
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        
        .masonry-item .album-cover {
            flex: 1;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
        }
        
        .nav-item i {
            font-size: 1.2rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 创建相册按钮 */
        .create-album {
            position: fixed;
            bottom: 75px;
            right: 15px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
            z-index: 999;
        }
        
        /* 无结果状态 */
        .no-results {
            padding: 40px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .no-results i {
            font-size: 3rem;
            margin-bottom: 15px;
            color: var(--text-light);
        }
        
        .no-results p {
            margin-bottom: 20px;
        }
        
        .no-results button {
            padding: 8px 20px;
            border-radius: 20px;
            background-color: var(--primary);
            color: white;
            border: none;
            font-size: 0.9rem;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <div class="nav-left">
            <i class="fas fa-arrow-left"></i>
        </div>
        <div class="nav-title">相册列表</div>
        <div class="nav-actions">
            <i class="far fa-bell"></i>
            <i class="far fa-cog"></i>
        </div>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-bar">
        <div class="search-input-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索相册、标签或地点...">
        </div>
        <button class="advanced-search-btn">高级</button>
    </div>
    
    <!-- 标签筛选 -->
    <div class="tag-filter">
        <div class="filter-tag active">全部</div>
        <div class="filter-tag">旅行</div>
        <div class="filter-tag">美食</div>
        <div class="filter-tag">聚会</div>
        <div class="filter-tag">自然</div>
        <div class="filter-tag">城市</div>
        <div class="filter-tag">宠物</div>
        <div class="filter-tag">工作</div>
        <div class="filter-tag">节日</div>
        <div class="filter-tag">运动</div>
    </div>
    
    <!-- 筛选器切换按钮 -->
    <div class="filter-toggle" id="filterToggle">
        <i class="fas fa-chevron-down"></i>
        <span>更多筛选</span>
    </div>
    
    <!-- 筛选面板 -->
    <div class="filters-panel" id="filtersPanel">
        <!-- 日期筛选 -->
        <div class="filter-section">
            <div class="filter-section-title">
                <i class="far fa-calendar-alt"></i>
                <span>日期范围</span>
            </div>
            <div class="date-filter">
                <div class="date-option active">全部时间</div>
                <div class="date-option">今天</div>
                <div class="date-option">本周</div>
                <div class="date-option">本月</div>
                <div class="date-option">今年</div>
                <div class="date-option">自定义</div>
            </div>
        </div>
        
        <!-- 参与人数筛选 -->
        <div class="filter-section">
            <div class="filter-section-title">
                <i class="fas fa-users"></i>
                <span>参与人数</span>
            </div>
            <div class="people-filter">
                <div class="people-option active">不限</div>
                <div class="people-option">仅自己</div>
                <div class="people-option">2-5人</div>
                <div class="people-option">6-10人</div>
                <div class="people-option">10人以上</div>
            </div>
        </div>
        
        <!-- 照片数量筛选 -->
        <div class="filter-section">
            <div class="filter-section-title">
                <i class="fas fa-images"></i>
                <span>照片数量</span>
            </div>
            <div class="people-filter">
                <div class="people-option active">不限</div>
                <div class="people-option">1-10张</div>
                <div class="people-option">11-50张</div>
                <div class="people-option">51-100张</div>
                <div class="people-option">100张以上</div>
            </div>
        </div>
        
        <!-- 排序方式 -->
        <div class="filter-section">
            <div class="filter-section-title">
                <i class="fas fa-sort"></i>
                <span>排序方式</span>
            </div>
            <div class="sort-options">
                <div class="sort-option active">
                    <span>最新创建</span>
                    <i class="fas fa-check"></i>
                </div>
                <div class="sort-option">
                    <span>最多照片</span>
                    <i class="fas fa-check"></i>
                </div>
                <div class="sort-option">
                    <span>最多点赞</span>
                    <i class="fas fa-check"></i>
                </div>
                <div class="sort-option">
                    <span>名称排序</span>
                    <i class="fas fa-check"></i>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 已选筛选标签 -->
    <div class="selected-filters" id="selectedFilters">
        <div class="selected-filter">
            <span>旅行</span>
            <i class="fas fa-times"></i>
        </div>
        <div class="selected-filter">
            <span>本月</span>
            <i class="fas fa-times"></i>
        </div>
        <div class="selected-filter">
            <span>最多点赞</span>
            <i class="fas fa-times"></i>
        </div>
        <div class="clear-filters">
            <i class="fas fa-broom"></i>
            <span>清除全部</span>
        </div>
    </div>
    
    <!-- 视图切换 -->
    <div class="view-toggle">
        <button class="toggle-btn active" data-view="grid" title="网格视图">
            <i class="fas fa-th"></i>
        </button>
        <button class="toggle-btn" data-view="list" title="列表视图">
            <i class="fas fa-list"></i>
        </button>
        <button class="toggle-btn" data-view="masonry" title="瀑布流视图">
            <i class="fas fa-th-large"></i>
        </button>
    </div>
    
    <!-- 相册列表容器 -->
    <div class="album-container">
        <div class="album-content album-grid">
            <!-- 相册1 -->
            <div class="album-card grid">
                <div class="album-cover grid">
                    <img src="https://picsum.photos/id/26/400/400" alt="旅行相册封面" class="album-image">
                    <div class="image-count">
                        <i class="fas fa-images"></i>
                        <span>24</span>
                    </div>
                </div>
                <div class="album-info grid">
                    <div class="album-title">夏日海边旅行</div>
                    <div class="album-meta grid">
                        <div class="album-date">
                            <i class="far fa-calendar"></i>
                            <span>2023-07-15</span>
                        </div>
                        <div class="album-people">
                            <i class="fas fa-users"></i>
                            <span>3人</span>
                        </div>
                        <div class="album-likes">
                            <i class="fas fa-heart"></i>
                            <span>89</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 相册2 -->
            <div class="album-card grid">
                <div class="album-cover grid">
                    <img src="https://picsum.photos/id/42/400/600" alt="山间徒步相册封面" class="album-image">
                    <div class="image-count">
                        <i class="fas fa-images"></i>
                        <span>36</span>
                    </div>
                </div>
                <div class="album-info grid">
                    <div class="album-title">周末山间徒步</div>
                    <div class="album-meta grid">
                        <div class="album-date">
                            <i class="far fa-calendar"></i>
                            <span>2023-07-08</span>
                        </div>
                        <div class="album-people">
                            <i class="fas fa-users"></i>
                            <span>5人</span>
                        </div>
                        <div class="album-likes">
                            <i class="fas fa-heart"></i>
                            <span>67</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 相册3 -->
            <div class="album-card grid">
                <div class="album-cover grid">
                    <img src="https://picsum.photos/id/28/400/400" alt="城市游览相册封面" class="album-image">
                    <div class="image-count">
                        <i class="fas fa-images"></i>
                        <span>18</span>
                    </div>
                </div>
                <div class="album-info grid">
                    <div class="album-title">古城一日游</div>
                    <div class="album-meta grid">
                        <div class="album-date">
                            <i class="far fa-calendar"></i>
                            <span>2023-07-02</span>
                        </div>
                        <div class="album-people">
                            <i class="fas fa-users"></i>
                            <span>2人</span>
                        </div>
                        <div class="album-likes">
                            <i class="fas fa-heart"></i>
                            <span>45</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 相册4 -->
            <div class="album-card grid">
                <div class="album-cover grid">
                    <img src="https://picsum.photos/id/65/400/400" alt="海岛旅行相册封面" class="album-image">
                    <div class="image-count">
                        <i class="fas fa-images"></i>
                        <span>42</span>
                    </div>
                </div>
                <div class="album-info grid">
                    <div class="album-title">海岛度假之旅</div>
                    <div class="album-meta grid">
                        <div class="album-date">
                            <i class="far fa-calendar"></i>
                            <span>2023-06-28</span>
                        </div>
                        <div class="album-people">
                            <i class="fas fa-users"></i>
                            <span>4人</span>
                        </div>
                        <div class="album-likes">
                            <i class="fas fa-heart"></i>
                            <span>92</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 创建相册按钮 -->
    <div class="create-album">
        <i class="fas fa-plus"></i>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <div class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </div>
        <div class="nav-item active">
            <i class="fas fa-images"></i>
            <span>相册</span>
        </div>
        <div class="nav-item">
            <i class="far fa-comment"></i>
            <span>消息</span>
        </div>
        <div class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 相册数据
        const albums = [
            {
                id: 1,
                title: "夏日海边旅行",
                cover: "https://picsum.photos/id/26/400/400",
                date: "2023-07-15",
                people: 3,
                likes: 89,
                count: 24,
                tags: ["旅行", "海边", "夏季"]
            },
            {
                id: 2,
                title: "周末山间徒步",
                cover: "https://picsum.photos/id/42/400/600",
                date: "2023-07-08",
                people: 5,
                likes: 67,
                count: 36,
                tags: ["旅行", "徒步", "自然"]
            },
            {
                id: 3,
                title: "古城一日游",
                cover: "https://picsum.photos/id/28/400/400",
                date: "2023-07-02",
                people: 2,
                likes: 45,
                count: 18,
                tags: ["旅行", "城市", "文化"]
            },
            {
                id: 4,
                title: "海岛度假之旅",
                cover: "https://picsum.photos/id/65/400/400",
                date: "2023-06-28",
                people: 4,
                likes: 92,
                count: 42,
                tags: ["旅行", "海岛", "度假"]
            },
            {
                id: 5,
                title: "美食探索之旅",
                cover: "https://picsum.photos/id/49/400/300",
                date: "2023-07-10",
                people: 2,
                likes: 58,
                count: 29,
                tags: ["美食", "城市", "探索"]
            },
            {
                id: 6,
                title: "好友聚会",
                cover: "https://picsum.photos/id/76/400/500",
                date: "2023-07-05",
                people: 8,
                likes: 36,
                count: 15,
                tags: ["聚会", "朋友", "庆祝"]
            }
        ];
        
        // 当前筛选条件
        const filters = {
            tags: [],
            date: "全部时间",
            people: "不限",
            photoCount: "不限",
            sort: "最新创建",
            search: ""
        };
        
        // 当前视图类型
        let currentView = 'grid';
        
        // 筛选面板切换
        const filterToggle = document.getElementById('filterToggle');
        const filtersPanel = document.getElementById('filtersPanel');
        
        filterToggle.addEventListener('click', () => {
            filtersPanel.classList.toggle('collapsed');
            filterToggle.classList.toggle('collapsed');
        });
        
        // 标签筛选
        const filterTags = document.querySelectorAll('.filter-tag');
        filterTags.forEach(tag => {
            tag.addEventListener('click', () => {
                // 处理"全部"标签
                if (tag.textContent === "全部") {
                    filterTags.forEach(t => t.classList.remove('active'));
                    tag.classList.add('active');
                    filters.tags = [];
                } else {
                    // 移除"全部"标签的选中状态
                    filterTags[0].classList.remove('active');
                    
                    // 切换当前标签状态
                    tag.classList.toggle('active');
                    
                    // 更新筛选条件
                    if (tag.classList.contains('active')) {
                        filters.tags.push(tag.textContent);
                    } else {
                        filters.tags = filters.tags.filter(t => t !== tag.textContent);
                        
                        // 如果没有选中的标签，选中"全部"
                        if (filters.tags.length === 0) {
                            filterTags[0].classList.add('active');
                        }
                    }
                }
                
                // 应用筛选并更新已选标签
                applyFilters();
                updateSelectedFilters();
            });
        });
        
        // 日期筛选
        const dateOptions = document.querySelectorAll('.date-option');
        dateOptions.forEach(option => {
            option.addEventListener('click', () => {
                dateOptions.forEach(o => o.classList.remove('active'));
                option.classList.add('active');
                filters.date = option.textContent;
                
                // 应用筛选并更新已选标签
                applyFilters();
                updateSelectedFilters();
            });
        });
        
        // 人数筛选
        const peopleOptions = document.querySelectorAll('.people-option');
        peopleOptions.forEach((option, index) => {
            // 只处理参与人数筛选部分
            if (option.parentElement.previousElementSibling?.textContent.includes('参与人数')) {
                option.addEventListener('click', () => {
                    // 清除同组中其他选项的选中状态
                    document.querySelectorAll('.filter-section:nth-child(2) .people-option')
                        .forEach(o => o.classList.remove('active'));
                    
                    option.classList.add('active');
                    filters.people = option.textContent;
                    
                    // 应用筛选并更新已选标签
                    applyFilters();
                    updateSelectedFilters();
                });
            }
        });
        
        // 照片数量筛选
        const photoCountOptions = document.querySelectorAll('.people-option');
        photoCountOptions.forEach((option, index) => {
            // 只处理照片数量筛选部分
            if (option.parentElement.previousElementSibling?.textContent.includes('照片数量')) {
                option.addEventListener('click', () => {
                    // 清除同组中其他选项的选中状态
                    document.querySelectorAll('.filter-section:nth-child(3) .people-option')
                        .forEach(o => o.classList.remove('active'));
                    
                    option.classList.add('active');
                    filters.photoCount = option.textContent;
                    
                    // 应用筛选并更新已选标签
                    applyFilters();
                    updateSelectedFilters();
                });
            }
        });
        
        // 排序筛选
        const sortOptions = document.querySelectorAll('.sort-option');
        sortOptions.forEach(option => {
            option.addEventListener('click', () => {
                sortOptions.forEach(o => o.classList.remove('active'));
                option.classList.add('active');
                filters.sort = option.querySelector('span').textContent;
                
                // 应用筛选并更新已选标签
                applyFilters();
                updateSelectedFilters();
            });
        });
        
        // 搜索功能
        const searchInput = document.querySelector('.search-input');
        searchInput.addEventListener('input', () => {
            filters.search = searchInput.value.trim().toLowerCase();
            applyFilters();
        });
        
        // 高级搜索按钮
        const advancedSearchBtn = document.querySelector('.advanced-search-btn');
        advancedSearchBtn.addEventListener('click', () => {
            // 展开筛选面板
            filtersPanel.classList.remove('collapsed');
            filterToggle.classList.remove('collapsed');
            
            // 聚焦到第一个筛选选项
            setTimeout(() => {
                dateOptions[0].focus();
            }, 300);
        });
        
        // 清除单个筛选条件
        const selectedFiltersContainer = document.getElementById('selectedFilters');
        selectedFiltersContainer.addEventListener('click', (e) => {
            if (e.target.classList.contains('fa-times')) {
                const filterText = e.target.parentElement.querySelector('span').textContent;
                removeFilter(filterText);
                
                // 更新已选标签
                updateSelectedFilters();
                // 应用筛选
                applyFilters();
            }
        });
        
        // 清除全部筛选条件
        document.querySelector('.clear-filters').addEventListener('click', () => {
            // 重置所有筛选条件
            filters.tags = [];
            filters.date = "全部时间";
            filters.people = "不限";
            filters.photoCount = "不限";
            filters.sort = "最新创建";
            filters.search = "";
            
            // 更新UI
            searchInput.value = "";
            filterTags.forEach((t, i) => t.classList.toggle('active', i === 0));
            dateOptions.forEach(o => o.classList.toggle('active', o.textContent === "全部时间"));
            document.querySelectorAll('.filter-section:nth-child(2) .people-option')
                .forEach(o => o.classList.toggle('active', o.textContent === "不限"));
            document.querySelectorAll('.filter-section:nth-child(3) .people-option')
                .forEach(o => o.classList.toggle('active', o.textContent === "不限"));
            sortOptions.forEach(o => o.classList.toggle('active', 
                o.querySelector('span').textContent === "最新创建"));
            
            // 更新已选标签
            updateSelectedFilters();
            // 应用筛选
            applyFilters();
        });
        
        // 移除特定筛选条件
        function removeFilter(filterText) {
            // 处理标签筛选
            if (filters.tags.includes(filterText)) {
                filters.tags = filters.tags.filter(t => t !== filterText);
                
                // 更新标签UI
                filterTags.forEach(t => {
                    if (t.textContent === filterText) {
                        t.classList.remove('active');
                    }
                });
                
                // 如果没有选中的标签，选中"全部"
                if (filters.tags.length === 0) {
                    filterTags[0].classList.add('active');
                }
            }
            // 处理日期筛选
            else if (filters.date === filterText) {
                filters.date = "全部时间";
                dateOptions.forEach(o => o.classList.toggle('active', o.textContent === "全部时间"));
            }
            // 处理排序筛选
            else if (filters.sort === filterText) {
                filters.sort = "最新创建";
                sortOptions.forEach(o => o.classList.toggle('active', 
                    o.querySelector('span').textContent === "最新创建"));
            }
        }
        
        // 更新已选筛选标签
        function updateSelectedFilters() {
            // 清空容器（保留清除全部按钮）
            const clearBtn = document.querySelector('.clear-filters');
            selectedFiltersContainer.innerHTML = '';
            selectedFiltersContainer.appendChild(clearBtn);
            
            // 添加标签筛选
            filters.tags.forEach(tag => {
                const filterEl = document.createElement('div');
                filterEl.className = 'selected-filter';
                filterEl.innerHTML = `
                    <span>${tag}</span>
                    <i class="fas fa-times"></i>
                `;
                selectedFiltersContainer.insertBefore(filterEl, clearBtn);
            });
            
            // 添加日期筛选（如果不是默认值）
            if (filters.date !== "全部时间") {
                const filterEl = document.createElement('div');
                filterEl.className = 'selected-filter';
                filterEl.innerHTML = `
                    <span>${filters.date}</span>
                    <i class="fas fa-times"></i>
                `;
                selectedFiltersContainer.insertBefore(filterEl, clearBtn);
            }
            
            // 添加排序筛选（如果不是默认值）
            if (filters.sort !== "最新创建") {
                const filterEl = document.createElement('div');
                filterEl.className = 'selected-filter';
                filterEl.innerHTML = `
                    <span>${filters.sort}</span>
                    <i class="fas fa-times"></i>
                `;
                selectedFiltersContainer.insertBefore(filterEl, clearBtn);
            }
            
            // 如果没有筛选条件，隐藏容器
            if (filters.tags.length === 0 && filters.date === "全部时间" && filters.sort === "最新创建") {
                selectedFiltersContainer.style.display = 'none';
            } else {
                selectedFiltersContainer.style.display = 'flex';
            }
        }
        
        // 应用筛选条件
        function applyFilters() {
            let filteredAlbums = [...albums];
            
            // 标签筛选
            if (filters.tags.length > 0) {
                filteredAlbums = filteredAlbums.filter(album => 
                    album.tags.some(tag => filters.tags.includes(tag))
                );
            }
            
            // 日期筛选
            if (filters.date !== "全部时间") {
                const today = new Date();
                const oneWeekAgo = new Date(today);
                oneWeekAgo.setDate(today.getDate() - 7);
                
                const oneMonthAgo = new Date(today);
                oneMonthAgo.setMonth(today.getMonth() - 1);
                
                const oneYearAgo = new Date(today);
                oneYearAgo.setFullYear(today.getFullYear() - 1);
                
                const albumDate = new Date(album.date);
                
                filteredAlbums = filteredAlbums.filter(album => {
                    const albumDate = new Date(album.date);
                    switch(filters.date) {
                        case "今天":
                            return albumDate.toDateString() === today.toDateString();
                        case "本周":
                            return albumDate >= oneWeekAgo;
                        case "本月":
                            return albumDate >= oneMonthAgo;
                        case "今年":
                            return albumDate >= oneYearAgo;
                        default:
                            return true;
                    }
                });
            }
            
            // 参与人数筛选
            if (filters.people !== "不限") {
                filteredAlbums = filteredAlbums.filter(album => {
                    switch(filters.people) {
                        case "仅自己":
                            return album.people === 1;
                        case "2-5人":
                            return album.people >= 2 && album.people <= 5;
                        case "6-10人":
                            return album.people >= 6 && album.people <= 10;
                        case "10人以上":
                            return album.people > 10;
                        default:
                            return true;
                    }
                });
            }
            
            // 照片数量筛选
            if (filters.photoCount !== "不限") {
                filteredAlbums = filteredAlbums.filter(album => {
                    switch(filters.photoCount) {
                        case "1-10张":
                            return album.count >= 1 && album.count <= 10;
                        case "11-50张":
                            return album.count >= 11 && album.count <= 50;
                        case "51-100张":
                            return album.count >= 51 && album.count <= 100;
                        case "100张以上":
                            return album.count > 100;
                        default:
                            return true;
                    }
                });
            }
            
            // 搜索筛选
            if (filters.search) {
                const searchTerm = filters.search.toLowerCase();
                filteredAlbums = filteredAlbums.filter(album => 
                    album.title.toLowerCase().includes(searchTerm) ||
                    album.tags.some(tag => tag.toLowerCase().includes(searchTerm))
                );
            }
            
            // 排序
            switch(filters.sort) {
                case "最新创建":
                    filteredAlbums.sort((a, b) => new Date(b.date) - new Date(a.date));
                    break;
                case "最多照片":
                    filteredAlbums.sort((a, b) => b.count - a.count);
                    break;
                case "最多点赞":
                    filteredAlbums.sort((a, b) => b.likes - a.likes);
                    break;
                case "名称排序":
                    filteredAlbums.sort((a, b) => a.title.localeCompare(b.title));
                    break;
            }
            
            // 渲染筛选结果
            renderAlbums(filteredAlbums);
        }
        
        // 视图切换功能
        const toggleButtons = document.querySelectorAll('.toggle-btn');
        const albumContent = document.querySelector('.album-content');
        
        toggleButtons.forEach(button => {
            button.addEventListener('click', () => {
                // 更新按钮状态
                toggleButtons.forEach(btn => btn.classList.remove('active'));
                button.classList.add('active');
                
                // 获取视图类型
                currentView = button.getAttribute('data-view');
                
                // 移除所有视图类
                albumContent.classList.remove('album-grid', 'album-list', 'album-masonry');
                
                // 添加当前视图类
                albumContent.classList.add(`album-${currentView}`);
                
                // 重新渲染相册
                applyFilters();
            });
        });
        
        // 渲染相册
        function renderAlbums(albumsToRender) {
            const albumContent = document.querySelector('.album-content');
            // 清空容器
            albumContent.innerHTML = '';
            
            // 处理无结果状态
            if (albumsToRender.length === 0) {
                albumContent.innerHTML = `
                    <div class="no-results">
                        <i class="far fa-images"></i>
                        <p>没有找到符合条件的相册</p>
                        <button id="resetFilters">清除筛选条件</button>
                    </div>
                `;
                
                // 绑定重置筛选按钮事件
                document.getElementById('resetFilters').addEventListener('click', () => {
                    document.querySelector('.clear-filters').click();
                });
                
                return;
            }
            
            // 根据当前视图类型渲染相册
            albumsToRender.forEach((album) => {
                const albumCard = document.createElement('div');
                
                // 设置卡片基础类
                albumCard.className = `album-card ${currentView}`;
                
                // 根据视图类型设置不同的结构
                if (currentView === 'masonry') {
                    // 瀑布流视图需要额外的容器
                    const masonryItem = document.createElement('div');
                    masonryItem.className = 'masonry-item';
                    
                    albumCard.innerHTML = `
                        <div class="album-cover ${currentView}">
                            <img src="${album.cover}" alt="${album.title}封面" class="album-image">
                            <div class="image-count">
                                <i class="fas fa-images"></i>
                                <span>${album.count}</span>
                            </div>
                        </div>
                        <div class="album-info ${currentView}">
                            <div class="album-title">${album.title}</div>
                            <div class="album-meta ${currentView}">
                                <div class="album-date">
                                    <i class="far fa-calendar"></i>
                                    <span>${album.date}</span>
                                </div>
                                <div class="album-people">
                                    <i class="fas fa-users"></i>
                                    <span>${album.people}人</span>
                                </div>
                                <div class="album-likes">
                                    <i class="${album.likes > 40 ? 'fas' : 'far'} fa-heart"></i>
                                    <span>${album.likes}</span>
                                </div>
                            </div>
                        </div>
                    `;
                    
                    masonryItem.appendChild(albumCard);
                    albumContent.appendChild(masonryItem);
                } else {
                    albumCard.innerHTML = `
                        <div class="album-cover ${currentView}">
                            <img src="${album.cover}" alt="${album.title}封面" class="album-image">
                            <div class="image-count">
                                <i class="fas fa-images"></i>
                                <span>${album.count}</span>
                            </div>
                        </div>
                        <div class="album-info ${currentView}">
                            <div class="album-title">${album.title}</div>
                            <div class="album-meta ${currentView}">
                                <div class="album-date">
                                    <i class="far fa-calendar"></i>
                                    <span>${album.date}</span>
                                </div>
                                <div class="album-people">
                                    <i class="fas fa-users"></i>
                                    <span>${album.people}人</span>
                                </div>
                                <div class="album-likes">
                                    <i class="${album.likes > 40 ? 'fas' : 'far'} fa-heart"></i>
                                    <span>${album.likes}</span>
                                </div>
                            </div>
                        </div>
                    `;
                    
                    albumContent.appendChild(albumCard);
                }
                
                // 点赞按钮事件
                const likeButton = albumCard.querySelector('.album-likes');
                likeButton.addEventListener('click', (e) => {
                    e.stopPropagation(); // 阻止事件冒泡到卡片
                    const icon = likeButton.querySelector('i');
                    const countEl = likeButton.querySelector('span');
                    let count = parseInt(countEl.textContent);
                    
                    if (icon.classList.contains('far')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        countEl.textContent = count + 1;
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        countEl.textContent = count - 1;
                    }
                });
            });
        }
        
        // 创建相册按钮点击事件
        document.querySelector('.create-album').addEventListener('click', () => {
            alert('创建新相册功能');
        });
        
        // 初始化页面
        updateSelectedFilters();
        applyFilters();
    </script>
</body>
</html>

